package com.leisurexi.aop.features;

import org.springframework.aop.ThrowsAdvice;

import java.lang.reflect.Method;
import java.util.Arrays;

/**
 * @author: leisurexi
 * @date: 2021-06-03 22:29
 */
public class MyThrowsAdvice implements ThrowsAdvice {

    public void afterThrowing(Exception e) {
        System.out.printf("Exception: %s\n", e);
    }

    public void afterThrowing(Method method, Object[] args, Object target, Exception e) {
        System.out.printf("Method: %s, args: %s, target: %s, exception: %s\n", method, Arrays.toString(args), target, e);
    }

}
